package com.wisdom.smartbook.widget;

import android.graphics.Outline;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewOutlineProvider;

/**
 * @ClassName: RoundViewOutlineProvider
 * @Description: java类作用描述
 * @Author: xjliu
 * @CreateDate: 2023/6/20 3:17 下午
 * @Version: 1.0
 */

public class RoundViewOutlineProvider extends ViewOutlineProvider {
    private final float radius;
    public RoundViewOutlineProvider(float radius) {
        this.radius = radius;
    }

    @Override
    public void getOutline(View view, Outline outline) {
        int leftMargin = 0;
        int topMargin = 0;
        Rect selfRect = new Rect(leftMargin, topMargin, view.getWidth(), view.getHeight());
        outline.setRoundRect(selfRect, radius);
    }
}
